import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Flecha here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Flecha extends Objeto
{
    /**
     * Act - do whatever the Flecha wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    private GreenfootImage [] flecha;
    private int delay =0;
    private int sprite=0;
    public Flecha()
    {
        flecha=new GreenfootImage[15];
         for(int i=1; i<=flecha.length; i++)
        {
            flecha[i-1] = new GreenfootImage("Flecha"+i+".png");
            flecha[i-1].scale(63,126);
        }
       
        setImage(flecha[sprite]);
    }
    public void act() 
    {
        animacion();
        // Add your action code here.
    }    
     public void animacion()
    {
       
        if(delay==4)
        {
            delay=0;
            sprite++;
            if(sprite==flecha.length-1)
            sprite=0;
            
            setImage(flecha[sprite]);
        }
        else
        delay++;
    }
}
